function plot_ens

[velP,velM,velP_ind,velM_ind,velP_raw,velM_raw]=get_vel_ind_from_adata(aux_data);
ftimes=get_frame_times(aux_data(2,:));
velM_ft=-velM(ftimes);
velP_ft=-velP(ftimes);
velM_sm=smooth2(velM_ft,500);

onset_ind=find(diff(velM_ft > 0.005)==1);
offset_ind=find(diff(velM_ft < 0.005) ==1);

onset= []
for ind = 1:length(onset_ind)
    onset(ind)=onset_ind(ind) - offset_ind(ind);
end

offset=[]
for ind = 1:length(onset_ind)
    offset(ind)=onset_ind(ind) - offset_ind(ind);
end

offset(offset < 500)=0;
offset_ind2=offset_ind(find(offset ~= 0));
onset(onset < 500)=0;
onset_ind2=onset_ind(find(onset ~= 0));

mdata=mean(data,3);

for ind = 1:1 %length(onset_ind2)-1
    figure, imagesc((mean(data(:,:,onset_ind2(ind):offset_ind2(ind+1)),3)-mean(data(:,:,offset_ind2(ind):onset_ind2(ind)),3)))
    colorbar
    set(gca,'Clim', [-500 3000])
end


for ind = 1:length(onset_ind2)-1
    mdata=mean(data(:,:,onset_ind2(ind):offset_ind2(ind+1)),3)-mean(data(:,:,offset_ind2(ind):onset_ind2(ind)),3);
end


figure, plot(velM_ft)
hold on,
plot(onset_ind2,0,'.r')
plot(offset_ind2,0,'.g')

figure, plot(raw_full)
hold on
plot(500*velM_ft+480,'r')
plot(20000*velP_ft+400,'g')

13304